completing teh sqaure method for turning point